home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / ghostscript / src / math_.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  54 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* math_.h */
  20. /* Generic substitute for math.h */
  21.  
  22. /* We must include std.h before any file that includes sys/types.h. */
  23. #include "std.h"
  24.  
  25. #ifdef VMS
  26. /*  DEC VAX/VMS C comes with a math.h file, but GNU VAX/VMS C does not. */
  27. #  include "vmsmath.h"
  28. #else
  29. #  include <math.h>
  30. #endif
  31.  
  32. /* math.h is different for Turbo and Unix.... */
  33. #ifndef M_PI
  34. #  ifdef PI
  35. #    define M_PI PI
  36. #  else
  37. #    define M_PI 3.14159265358979324
  38. #  endif
  39. #endif
  40.  
  41. /* Factors for converting between degrees and radians */
  42. #define degrees_to_radians (M_PI / 180.0)
  43. #define radians_to_degrees (180.0 / M_PI)
  44.  
  45. /* Define the hypot procedure on those few systems that don't provide it. */
  46. #ifdef _IBMR2
  47. /* The RS/6000 has hypot, but math.h doesn't declare it! */
  48. extern double hypot(double, double);
  49. #else
  50. #  if !defined(__TURBOC__) && !defined(BSD4_2) && !defined(VMS)
  51. #    define hypot(x,y) sqrt((x)*(x)+(y)*(y))
  52. #  endif
  53. #endif
  54.